<%@page contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<% String basepath = request.getContextPath(); %>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<link href="<%=basepath%>/css/nomal.css" rel="stylesheet" type="text/css" />
		<script src="js/jquery-1.4.4.js" type="text/javascript"></script>
		<script language="javascript" type="text/javascript" src="<%=basepath%>/js/validatorTool.js"></script>
		<script language="javascript" type="text/javascript" src="<%=basepath%>/js/utilTool.js"></script>
<style type="text/css">
.mycolor {
	color: #FF0000;
}
</style>
<script type="text/javascript">
		
	jQuery(document).ready(
		function(){
			//供应商类型
			initselect("suptype",'${currentInfo.suptype}');
			//企业性质
			//initselect("entproperty",'${currentInfo.entproperty}');
			//初始化两个字段：所属行业，经济类型
			//initmodel("industryname,ectypename","${currentInfo.industry}"+","+"${currentInfo.ectype}");
			initmodel("ectypename","${currentInfo.ectype}");
		}
	)
	
	//初始化参考数据的名称
	function initmodel(name,pk){
		jQuery.ajax({
				type: "GET", 
	            async:false,
	            url:"<%=basepath%>/register/initmodel?pk="+pk, 
	            dataType:"text", 
	            success:function(result){   
	                if(result !=''){
	                	var items = result.split("|");
	                	var nameitem = name.split(",");
	                	for(var i=0;i<nameitem.length;i++){
	                		if(i<items.length){
	                			document.getElementById(nameitem[i]).value = items[i];
	                		}
	                	}
	                }
	            } 
	        }
		)
	}
	//这里进行提交
	function nextStep() {
		var ErrMsg = checkField();
		if(trim(ErrMsg)!=""){
			alert(ErrMsg);
			return;
		}
		var obj = document.all;
		if(isValidBuildDate(obj.builddate) && subReduNumRegFund(obj.regfound,2,13)){
			document.forms[0].action = "<%=basepath %>/selfinfo/editNextStep?nextStep=2";
			document.forms[0].submit();
		}
	}
	
	//必输项校验
	function checkField(){
		    var supnameval = document.getElementById("supname").value;
			var taxpayeridval = document.getElementById("taxpayerid").value;
			var legalbodyval = document.getElementById("legalbody").value;
			var salelicencenoval = document.getElementById("salelicenceno").value;
			var builddateval = document.getElementById("builddate").value;
			var regfoundval = document.getElementById("regfound").value;
			var ectypenameval = document.getElementById("ectypename").value;
			var ErrMsg = "";
			
			if(supnameval == null ||trim(supnameval)==""){
				ErrMsg += "供应商全称不允许为空!";
			}
			if(taxpayeridval == null || trim(taxpayeridval)==""){
				ErrMsg += "\n纳税人登记号不允许为空!";
			}
			if(legalbodyval == null || trim(legalbodyval)==""){
				ErrMsg += "\n法人不允许为空!";
			}
			if(salelicencenoval == null || trim(salelicencenoval)==""){
				ErrMsg += "\n营业执照号不允许为空!";
			}
			if(builddateval == null || trim(builddateval)==""){
				ErrMsg += "\n成立日期不允许为空!";
			}
			if(regfoundval == null || trim(regfoundval)==""){
				ErrMsg += "\n注册资本不允许为空!";
			}
			if(ectypenameval == null || trim(ectypenameval)==""){
				ErrMsg += "\n经济类型不允许为空!";
			}
			var bool = isNum(regfoundval);
			if(bool == false){
			   	alert("\n注册资本不合法!");
			   	return;
			}
			return ErrMsg;
	}
	
	function initList(id,code){
		var url = "iframe:<%=basepath%>/register/initlist?id="+id+"&code="+code;
		dialog("", url,"500", "400", "","");
	}
	
	//初始化供应商分类
	function initSupClsList(id){
		var url = "iframe:<%=basepath%>/selfinfo/initSupClsList?id="+id+"";
		dialog("", url,"500", "400", "","");
	}
	
	//初始化上级供应商
	function initSupList(id){
		var url = "iframe:<%=basepath%>/selfinfo/initSupList?id="+id+"";
		dialog("", url,"500", "400", "","");
	}
	
	function trim(strToTrim) { 
	     result=strToTrim 
	     for (_i=0; _i<strToTrim.length; _i++) { 
	            if (strToTrim.charAt(_i)==" ") result=strToTrim.substr(_i+1) 
	            else _i=strToTrim.length 
	     } 
	     strToTrim=result 
	     for (_i=strToTrim.length-1; _i>=0; _i--) { 
	            if (strToTrim.charAt(_i)==" ") result=strToTrim.substr(0,_i) 
	            else _i=0 
	      } 
       return result 
	} 

	function isValidBuildDate(obj){
		if(!isEmpty(obj.value) && !isDate(obj.value)){
			jQuery("#message").html("请重新输入YYYY-MM-DD格式日期");
			obj.focus();
			return false;
		}else{
			jQuery("#message").html("");
			return true;
		}
	}
	function isEmpty(str){
		if(null == str || typeof str == "undefined"){
			return true;
		}
		var checkStr = trimStr(str);
		if(checkStr.length == 0){
			return true;
		}
		return false;
	}
</script>
</head>
	<body class="fullbody">
		<form method="post" >
				<div class="context">
					<div class="position">
						<div class="tposi">
							当前位置：
							<a href="javascript:changeMenu(1,'<%=request.getContextPath()%>/infopub/pubmain?menuid=1');" class="linkstyle">首页</a>&nbsp;&gt;&gt;&nbsp;
							<a href="javascript:changeMenu(4,'')" class="linkstyle">自助服务</a>&nbsp;&gt;&gt;&nbsp;
							<span class="curposition">企业信息维护</span>
						</div>
						<div class="help">
							<a href="javascript:void(null);" onclick="doHelp('<%=request.getContextPath()%>/help/html/QYXXXG.html');" class="linkstyle">帮助</a>
						</div>
					</div>
					<div class="margin8"> </div>
					<div class="subpage_title">
						<div class="title_index">
							<img src="<%=basepath%>/images/common/dot03.gif" alt="" border="0" /> &nbsp;企业信息维护
						</div>
						<div class="rollback">
							<a href="javascript:changeMenu(4,'')" class="linkstyle">&lt;&lt;&nbsp;返回自助服务</a>
						</div>
					</div>
					<div class="margin10"></div>
					<div class="orginfo">
						<c:if test="${currentInfo.isReadAfterAudit==null ||currentInfo.isReadAfterAudit==\"N\"}">
							<div class="spliter_line"> </div>
							<div class="margin10"> </div>
							<div class="message">
	                            <img src="<%=basepath%>/images/account/msg.png" alt="" />&nbsp;信息修改已通过审核，您的企业信息已经更新！
	                        </div>
                        </c:if>
						<div class="spliter_line"> </div>
						<div class="subpage_title_small">
							注：企业信息修改后需要提交采购方审核。
						</div>
						<div class="margin10"> </div>
						<div class="lineconner1" >
							<div class="left1"> <img src="<%=basepath%>/images/conner/a_01.png" alt="" /> </div>
							<div class="right1"> <img src="<%=basepath%>/images/conner/b_01.png" alt="" /> </div>
							<div class="c_context" >
								<table cellpadding="0" cellspacing="0" border="0" width="700">
									<tr class="title">
										<td colspan="4"> 
											<input type="hidden" name="supCate" id="pkSupCate"
												value="${currentInfo.supCate}" class="textstyle" readOnly />
											<input type="hidden" name="parentSup" id="supply"
												value="${currentInfo.parentSup}" class="textstyle" readOnly/>
											<input type="hidden" name="suprank" value="${currentInfo.suprank}" />
											<input type="hidden" name="supstatus" value="${currentInfo.supstatus}" />
										</td>
									</tr>
									<tr class="inputrow">
										<td class="ww" >供应商全称&nbsp;&nbsp;<br/><font class="memoFont">(与营业执照一致)：</font></td>
										<td class="w5">
											<input type="hidden" name="pk_supinfocheck_h"
												value="${currentInfo.pk_supinfocheck_h}" />
											<input type="text" name="supname" class="textstyle"
												value="${currentInfo.supname}" />
											<span class="needfill">*</span>
										</td>
										<td class="ww">英文全称：</td>
										<td class="w5">
											<input type="text" name="supenname" class="textstyle"
												value="${currentInfo.supenname}" />
										</td>
									</tr>
									<tr class="inputrow">
										<td class="ww">供应商类型：</td>
										<td class="w5">
											<select name="suptype" id="suptype" class="textstyle"  >
												<option value="0">外部单位</option>
												<option value="1">内部单位</option>
											</select>
										</td>
										<td class="ww">银行资信等级：</td>
										<td class="w5">
											<select name="bankcreditrank" id="bankcreditrank" class="textstyle" >
												<option></option>
												<option value="3"
												<c:if test="${currentInfo.bankcreditrank == '3'}">{
													selected
												}												
												</c:if>>3A</option>
												<option value="2"
												<c:if test="${currentInfo.bankcreditrank == '2'}">{
													selected
												}												
												</c:if>>2A</option>
												<option value="1"
												<c:if test="${currentInfo.bankcreditrank == '1'}">{
													selected
												}												
												</c:if>>A</option>
											</select>
										</td>
									</tr>
									<tr class="inputrow">
										<td class="ww">纳税人登记号：</td>
										<td class="w5">
											<input type="text" name="taxpayerid"
												value="${currentInfo.taxpayerid}" class="textstyle" />
											<span class="needfill">*</span>
										</td>
										<td class="ww">法人：</td>
										<td class="w5">
											<input type="text" name="legalbody"
												value="${currentInfo.legalbody}" class="textstyle" />
											<span class="needfill">*</span>
										</td>
									</tr>
									<tr class="inputrow">
										<td class="ww">营业执照号：</td>
										<td class="w5">
											<input type="text" name="salelicenceno"
												value="${currentInfo.salelicenceno}" class="textstyle" />
											<span class="needfill">*</span>
										</td>
										<td class="ww">成立日期：</td>
										<td class="w5" style="width:260px">
											<input type="text"  name="builddate"
												value="${currentInfo.builddate}" id="builddate" 
												onchange="isValidBuildDate(this);" 
												class="textstyle" />
											<input type="image" src="<%=basepath%>/images/common/cal.jpg" onclick="return showCalendar('builddate', 'y-mm-dd');"/>
											<span class="needfill">*</span>
										</td>
									</tr>
									<tr class="inputrow">
										<td class="ww">注册资本：</td>
										<td class="w5">
											<input type="text" name="regfound"
												value="${currentInfo.regfound}" class="textstyle" onChange="subReduNumRegFund(this,2,13)"/>
											<span class="needfill">*</span>
										</td>
										<td class="ww">经济类型：</td>
										<td class="w5">
											<input type="text" name="ectypename" id="ectypename"
												 class="textstyle" onclick="initList('ectype','SYS004_0xx')" readOnly/> 
											<span class="needfill">*</span>
											<input type="hidden" name="ectype" id="ectype"
												value="${currentInfo.ectype}" class="textstyle"  readOnly/>
										</td>
									</tr>
									<tr>
										<td colspan="4">&nbsp;</td>
									</tr>
									<tr class="buttonrow">
										<td align="right" colspan="4">
											<input type="button" value="下一步" onclick="nextStep();" class="btnscs" />
										</td>
									</tr>
								</table>

							</div>
							 
						</div>
						<div>
						</div>
						<div class="margin20">
							<div id="message" class="mycolor">
								<c:out value="${ERROR_MESSAGE}"></c:out>
							</div>
						</div>
					</div>
					<div class="margin20">
					</div>
				</div>
				<div class="margin10">
				</div>
		</form>
	</body>